<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/sys/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>设置地图坐标信息</title>
<%@ include file="/WEB-INF/sys/include/css.jsp"%>
<style type="text/css">
html{height:100%}
body{height:100%;margin:0px;padding:0px;overflow:hidden;}
.container{width:100%;height:100%;}
.controlbar{width:100%;height:50px;border-top:1px solid #999;overflow:hidden;}
.controlbar div.form{padding:7px;}
.controlbar div.form button{margin-left:10px;font-weight:bold;}
</style>
</head>
<body>
<div id="container" class="container"></div>
<div class="controlbar">
	<div class='form'>
		<div class="group">
			<div class="label" style="width:40px;margin-left:10px;">经度:</div>
			<div class="item"><input type="text" id="mkrlng" style="width:120px;height:22px;" readonly="readonly" /></div>
			<div class="label" style="width:40px;margin-left:10px;">纬度:</div>
			<div class="item"><input type="text" id="mkrlat" style="width:120px;height:22px;" readonly="readonly" /></div>
			
			<div class="item button-item" style="float:right;margin-right:10px;"><button id="cancel1" type="button">取消</button></div>
			<c:if test="${view ne 'true'}">
			<div class="item button-item" style="float:right;"><button id="submit1" type="button" class="highlight">确定</button></div>
			</c:if>
			<span id="mapstatus"></span>
		</div>
	</div>
</div>
<%@ include file="/WEB-INF/sys/include/script.jsp" %>
<script type="text/javascript" src="https://map.qq.com/api/js?v=2.exp&key=QVPBZ-QJO6X-2S24Q-TVPQO-CRYC2-JMBL2" charset="utf-8"></script>
<script type="text/javascript" src="${path }/res/js/map/map-coords.js"></script>
<script type="text/javascript">
var dialog, map;
$(function() {
	$("#container").height($(window).height() - 52);
	dialog = frameElement.dialog;
	var dialogData = dialog.get('data');
	var center = {lat:39.217835,lng:115.858798}, zoom=6, marker;
	
	if(dialogData.lng && dialogData.lat){
		center = {lng: parseFloat(dialogData.lng), lat: parseFloat(dialogData.lat)};
		zoom = 15;
		marker = {lng: parseFloat(dialogData.lng), lat: parseFloat(dialogData.lat), id: '${manufacturer.manufacturerid}', name: '${manufacturer.manufacturerName}'};
	}
	
	map = new MapCoords(document.getElementById('container'), {
		path: '${path}',
		type: '${type}',
		manufacturerid: '${manufacturer.manufacturerid}',
		view: '${view}',
		center: center,
		zoom: zoom,
		marker: marker,
		onMarkerDragend:function(point){
			$('#mkrlng').val(''+point.lng.toFixed(8));
			$('#mkrlat').val(''+point.lat.toFixed(8));
		}
	});
	
	$("#submit1").click(function(){
		dialogData.newLng = $('#mkrlng').val();
		dialogData.newLat = $('#mkrlat').val();
		dialog.close();
	});

	$("#cancel1").click(function(){
		dialog.close();
	});
});

</script>
</body>
</html>